package com.bjgraphite.report.exception;


import com.bjgraphite.report.enums.BizErrorCode;

/**
* @Description: 异常基类
* @author zhouxiaolong
* @date 2018/4/19 15:30
* @version V1.0
*/
public abstract class BaseException extends RuntimeException{

    private static final long serialVersionUID = 1165713063612509007L;
    private BizErrorCode bizErrorCode;
    private Object[] params;

    private BaseException(BizErrorCode bizErrorCode, String message, Throwable cause) {
        super(message, cause);
        this.bizErrorCode = bizErrorCode;
    }

    protected BaseException(BizErrorCode bizErrorCode) {
        this(bizErrorCode, bizErrorCode.getMessage(), null);
    }

    protected BaseException(BizErrorCode bizErrorCode, Object... params) {
        this(bizErrorCode, bizErrorCode.getMessage(), null);
        this.params = params;
    }

    private BaseException(BizErrorCode bizErrorCode, String message) {
        this(bizErrorCode, message, null);
    }

    protected BaseException(BizErrorCode bizErrorCode, Throwable cause) {
        this(bizErrorCode, null, cause);
    }



    public BizErrorCode getBizErrorCode() {
        return bizErrorCode;
    }

    public Object[] getParams() {
        return params;
    }
}
